/*
**
**以下是页面配置
**
*/

var SCREEN_ORIENTION_V = "screen_oriention_v";
var SCREEN_ORIENTION_H = "screen_oriention_h";
var MY_SCREEN_ORIENTION = SCREEN_ORIENTION_V;//v=竖着，h＝横着
var CORE_RES_SIZE_PER = .3;//初始核心资源占比，会在加载主页时候体现出来(插件库js需要用到的时间比例)
var Video_RES_SIZE_PER = .1;//视频占的比例
var VIRTURL_PATH ="/eosi-h5-frame/";
VIRTURL_PATH ="/";
var BASE_PATH = ".."+VIRTURL_PATH;

var DEBUG = true;
var version = "0.5";
if(DEBUG==true){
    jsExt = "";
    version = Math.random();
}else{
    jsExt = ".min";
}

/*
**
**以下是loading配置
**
*/
//type:Default,OneSquare,ZoomDot,ThreeDots,CircleDots,CircleDots1,FoldCube,TwoCubes
var LOADING_STYLE = {
    "type":"OneSquare",
    "color":"#ff0000",
    "info":{
        "label":{"txt":"玩命加载中，请稍后...%percent%","c":"#000"},
        "bar":{"bg_c":"#ccc","c":"#ff0000","w":.5,"h":2}
    }
};
if(LOADING_STYLE.info){
    document.write("<link href='css/loadingDefault.css?v="+version+"' rel='stylesheet' type='text/css'>");
}
if(LOADING_STYLE.type!= "default"){
    document.write("<link href='css/loading"+LOADING_STYLE.type+".css?v="+version+"' rel='stylesheet' type='text/css'>");
}

/*
**
**以下是路由配置
**
*/
//此处名字必须与ContenLayerManifest.json名字一致
var PAGE_1 = "page1";
var PAGE_2 = "page2";
var PAGE_3 = "page3";
var PAGE_4 = "page4";
var pages = [
    {
        "id": PAGE_1,
        "name":"page1",
        "src": BASE_PATH + "static/pages/Page1Manifest.json",
        "callback":"loadPageMediaGrid",
        "p_type": {"type":"default"},
        "loading":"global",
        "reload_type":"animation",
        "preload":true,
        "button_on":"menu_icon_0",
        "type":"pages"
    },
    {
        "id": PAGE_2,
        "name": "page2",
        "src": BASE_PATH + "static/pages/Page2Manifest.json",
        "callback":"loadPage2MediaGrid",
        "p_type": {"type":"default"},
        "loading":"global",
        "reload_type":"none",
        "preload":true,
        "button_on":"menu_icon_1",
        "type":"pages"
    },
    {
        "id": PAGE_3,
        "name": "page3",
        "src": BASE_PATH + "static/pages/Page3Manifest.json",
        "callback":"loadPage3MediaGrid",
        "p_type": {"type":"default"},
        // "p_type": {"type":"fullScreenVideo"},
        "loading":"global",
        "reload_type":"none",
        "preload":true,
        "button_on":"menu_icon_2",
        "type":"pages"
    },
    {
        "id": PAGE_4,
        "name": "page4",
        "src": BASE_PATH + "static/pages/Page3Manifest.json",
        "callback":"loadPage3MediaGrid",
        "p_type": {"type":"default"},
        // "p_type": {"type":"fullScreenVideo"},
        "loading":"global",
        "reload_type":"none",
        "preload":true,
        "button_on":"menu_icon_2",
        "type":"pages"
    }
]
var loading_page={
    "open":true,//决定是否使用create loading 动画
    "id": "create_load",
    "name":"create_load",
    "src": BASE_PATH + "static/load/PageLoadManifest.json",
    "callback":"loadPageLoadMediaGrid",
    "p_type": {"type":"default"},
    "loading":"global",
    "reload_type":"animation",
    "preload":true,
    "button_on":"menu_icon_0",
    "numberSet":{"textfirst":"前","textafter":"%后","font":"30px 黑体","color":"#000000","x":0.5,"y":0.6}
}

var cur_page = "";
var fun_page1 = function () {
    cur_page=PAGE_1;
};
var fun_page2 = function () {
    cur_page=PAGE_2;
};
var fun_page3 = function () {
    cur_page=PAGE_3;
};
var fun_page4 = function () {
    cur_page=PAGE_4;
};
var routes = {
    '/page1':fun_page1,
    '/page2':fun_page2,
    '/page3':fun_page3,
    '/page4':fun_page4
    /*'/page1/:debug': {
        on: function (debug) { console.log(debug) }
    }*/
};

var router = Router(routes);

//    router.init();
router.init(['/page1']);

function jumpTo(){
    if(contentLayer){
        contentLayer.jumpTo(cur_page);
    }
}

/*
**
**以下是视频配置播放
**
*/
var Video={
    USE_VIDEO:true,//如果为false就不会存在video的资源
    firstpage_video:false,// 设置一下 矫正一下loading数字 使用首页预加载并播放视频设置为true
    // html_play_src:BASE_PATH + "videos/20S.mp4",//默认播放技术隐藏进路由页面 只能用于首次进入 如果没有这个元素就会去VideoMainf.json 寻找是否有autoplay：true需要自动播放的视频
}

/*
**
**以下是背景音乐配置播放
**
*/
var bgmusic={
    src:"sounds/background.mp3"
}

if(Video.USE_VIDEO){
    if(Video.firstpage_video){
        Video_RES_SIZE_PER=1;
    }else{
        CORE_RES_SIZE_PER=Video_RES_SIZE_PER+CORE_RES_SIZE_PER;
    }
}



